﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>layui在线调试</title>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
</head>
<body>
    <form class="layui-form" action="/CurrencyContract/UpdateCurrency" lay-filter="example">
        <div class="layui-form-item">
            <div style="float:left">
                <label class="layui-form-label">合同标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="ContractTitle" id="ContractTitle" lay-verify="contractTitle" autocomplete="off" placeholder="请输入标题" class="layui-input">
                </div>
            </div>
            <div style="float:left">
                <label class="layui-form-label">承运单位：</label>
                <div class="layui-input-block">
                    <select name="OppositeUnit" lay-filter="oppositeUnit">
                        <option value="" selected=""></option>
                        <option value="1">写作</option>
                        <option value="2">阅读</option>
                        <option value="3">游戏</option>
                        <option value="4">音乐</option>
                        <option value="5">旅行</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div style="float:left">
               <label class="layui-form-label">负责人：</label>
                <div class="layui-input-block">
                    <select name="OtherPartyPerson" lay-filter="otherPartyPerson">
                        <option value="" selected=""></option>
                        <option value="1">写作</option>
                        <option value="2">阅读</option>
                        <option value="3">游戏</option>
                        <option value="4">音乐</option>
                        <option value="5">旅行</option>
                    </select>
                </div>
            </div>
            <div style="float:left">
                <label class="layui-form-label">线路：</label>
                <div class="layui-input-block">
                    <select name="Line" lay-filter="line">
                        <option value="" selected=""></option>
                        <option value="1">写作</option>
                        <option value="2">阅读</option>
                        <option value="3">游戏</option>
                        <option value="4">音乐</option>
                        <option value="5">旅行</option>
                    </select>
                </div>
            </div>
         </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><span style="color:red">*</span>吨运价（元/吨）</label>
                <div class="layui-input-inline">
                    <input type="tel" name="Freightrate" lay-verify="required" lay-reqtext="吨运价是必填项，岂能为空？" autocomplete="off" class="layui-input" placeholder="请输入吨运价">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label"><span style="color:red">*</span>包车条件吨位</label>
                <div class="layui-input-inline">
                    <input type="text" name="CharterConditions" lay-verify="required" lay-reqtext="包车条件吨位是必填项，岂能为空？" autocomplete="off" class="layui-input" placeholder="请输入包车条件吨位">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label"><span style="color:red">*</span>包车金额（元/辆）：</label>
                <div class="layui-input-block">
                    <input type="text" name="CharterAmount" lay-verify="required | Number" lay-reqtext="包车金额是必填项，岂能为空？"  autocomplete="off" placeholder="请输入包车金额" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">经办人</label>
                <div class="layui-input-inline">
                    <input type="tel" name="Handler" lay-verify="Handler" autocomplete="off" class="layui-input" placeholder="请输入经办人">
                </div>
            </div>
        </div>
        <div class="layui-inline">
                <label class="layui-form-label">签订时间</label>
                <div class="layui-input-inline">
                    <input type="text" name="SigningDate" id="SigningDate" lay-verify="date" autocomplete="off" class="layui-input" placeholder="年/月/日">
                </div>
            </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">合同标的或项目说明</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" name="ProjectDescription" class="layui-textarea"></textarea>
            </div>
        </div>
         <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">合同主要条款/变更条款</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入内容" name="ChangeClause" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <input name="Id" type="text" hidden/>
                <input name="CreateTimedate" type="text" hidden/>
                <input name="NumberId" type="text" hidden/>
                <input name="Enclosure" type="text" hidden/>
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">保存</button>
                <button class="layui-btn layui-btn-primary" onclick="location.href='/CurrencyContract/Index'">返回</button>
            </div>
        </div>
    </form>
    <script src="~/libs/jquery/jquery.js"></script>
    <script src="~/layui/layui.js" charset="utf-8"></script>

    <script>
        layui.use(['form', 'layedit', 'laydate','upload'], function(){
          var form = layui.form
          ,layer = layui.layer
          ,layedit = layui.layedit
          ,laydate = layui.laydate
          ,upload = layui.upload
          ,element = layui.element;

          //日期
          laydate.render({
            elem: '#SigningDate'
          });
          form.render();
          //监听提交
          form.on('submit(demo1)', function(data){
          });
          //指定允许上传的文件类型
          upload.render({
            elem: '#test3'
            ,url: '/CurrencyContract/FileUpload' //此处配置你自己的上传接口即可
            ,accept: 'file' //普通文件
            ,done: function(res){
              layer.msg('上传成功');
              console.log(res);
            }
          });
        });
        $(function(){
            Edit();
        })
        function Edit(){
            $.ajax({
                url:"/CurrencyContract/GetCurrencyById?Id="+@ViewBag.Id,
                type:"get",
                dataType:"json",
                success:function(obj){
                    $("[name=Id]").val(obj.id);
                    $("[name=ContractTitle]").val(obj.contractTitle);
                    $("[name=OppositeUnit]").val(obj.oppositeUnit);
                    $("[name=OtherPartyPerson]").val(obj.otherPartyPerson);
                    $("[name=Line]").val(obj.line);
                    $("[name=Freightrate]").val(obj.freightrate);
                    $("[name=CharterConditions]").val(obj.charterConditions);
                    $("[name=CharterAmount]").val(obj.charterAmount);
                    $("[name=Handler]").val(obj.handler);
                    $("[name=SigningDate]").val(obj.signingDate);
                    $("[name=ProjectDescription]").val(obj.projectDescription);
                    $("[name=ChangeClause]").val(obj.changeClause);
                    $("[name=NumberId]").val(obj.numberId);
                    $("[name=Enclosure]").val(obj.enclosure);
                    $("[name=CreationTime]").val(obj.creationTime);
                    //console.log($("[name=Id]").val());
                }
            })
        }
    </script>
</body>
</html>
